package com.cc.service.impl;

import com.cc.dao.AttendanceRecordDao;
import com.cc.dao.impl.AttendanceRecordDaoImpl;
import com.cc.entity.AttendanceRecord;
import com.cc.entity.Page;
import com.cc.service.AttendanceRecordService;

import java.sql.SQLException;

/**
 * @version 1.0
 * @description:TODO
 * @authorAdministrator
 * @date 2025/4/2 08:39
 */
public class AttendanceRecordServiceImpl implements AttendanceRecordService {
    AttendanceRecordDao attendanceRecordDao = new AttendanceRecordDaoImpl();

    @Override
    public boolean hasCheckedInToday(String employeeId) {
        return attendanceRecordDao.isClockIn(employeeId);
    }

    @Override
    public void checkIn(String employeeId) {
        attendanceRecordDao.clockIn(employeeId);
    }

    @Override
    public void checkOut(String employeeId) {
        attendanceRecordDao.updateClockIn(employeeId);
    }

    @Override
    public Page<AttendanceRecord> getAttendanceRecordsByPage(Page<AttendanceRecord> page){
        return attendanceRecordDao.findAll(page);
    }
}
